package com.dries.portal.module.coupon.vo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @Description:
 * @Author ZSY
 * @createTime 2020/7/27 13:22
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CouponVo {

    private Integer id;
    /**
     * 模板ID
     */
    private Integer templateId;
    /**
     * 用户ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;
    /**
     * 优惠券码
     */
    private String couponCode;
    /**
     * 领取时间
     */
    private Date assignTime;
    /**
     * 领取状态
     */
    private Integer status;
    /**
     * 用户优惠券对应的模板信息
     */
    private CouponTemplateSDK templateSDK;

    /** 返回一个无效的 Coupon 对象 */
    public static CouponVo invalidCoupon() {
        CouponVo coupon = new CouponVo();
        coupon.setId(-1);

        return coupon;
    }

    /** 构造优惠券 */
    public CouponVo(Integer templateId, Long userId, String couponCode, Integer status) {
        this.templateId = templateId;
        this.userId = userId;
        this.couponCode = couponCode;
        this.status = status;
    }
}
